#include "cardType.h"
#include "pokerUtil.h"

const ThreeStraight::Type FourThreeSame::getCardType() const
{
	return ThreeStraight::Type::CT_THREE_STRAIGHT;
}

bool ThreeStraight::CheckType(const std::vector<PokerCard>& CardList)
{
	int countNum = 0;
	std::vector<PokerCard> temp;

	//0
	for (std::vector<PokerCard>::const_iterator it = CardList.begin(); it < CardList.begin() + 3; ++it)
	{
		temp.push_back(*it);
	}

	//1
	if ( pokerUtil::CheckSpcial(temp) && !pokerUtil::CheckFlush(temp) )
	{
		temp.clear();
		for (std::vector<PokerCard>::const_iterator it = CardList.begin() + 3; it < CardList.begin() + 8; ++it)
		{
			temp.push_back(*it);
		}
	}
	else
	{
		return false;
	}


	//2
	if ( pokerUtil::CheckSpcial(temp) && !pokerUtil::CheckFlush(temp) )
	{
		temp.clear();
		for (std::vector<PokerCard>::const_iterator it = CardList.begin() + 8; it < CardList.begin() + 14; ++it)
		{
			temp.push_back(*it);
		}
	}
	else
	{
		return false;
	}

	//3
	if ( pokerUtil::CheckSpcial(temp) && !pokerUtil::CheckFlush(temp) )
	{
		return true;
	}
	else
	{
		return false;
	}
}